#include "directoryscanner.h"
#include <QDirIterator>

DirectoryScanner::DirectoryScanner(const QString &dir)
{
    QDir selectedDir(dir);
    selectedDir.setFilter(QDir::Files | QDir::Dirs | QDir::NoDot | QDir::NoDotDot);
    selectedDir.setNameFilters(QStringList() << "*.*");
    findFiles(selectedDir);
}

QStringList DirectoryScanner::files() const
{
    return mFiles;
}

void DirectoryScanner::findFiles(QDir rootDir)
{
    QDirIterator it(rootDir, QDirIterator::Subdirectories);
    while (it.hasNext()) {
        mFiles << it.next();
    }
}
